package cn.study.synchronizedTest;

import org.openjdk.jol.info.ClassLayout;

/**
 * @author  跟大佳一起学架构
 *
 * 关闭指针压缩（-XX:-UseCompressedOops）
 */
public class ObjectHeadTest {

    public static void main(String[] args) throws InterruptedException {
        // step 1
        objectTest();
        testObjectTest();
        testArrayTest();
    }

    public static void objectTest(){
        Object obj = new Object();
        //查看对象内部信息
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
    }

    public static void testObjectTest(){
        Object obj = new Test();
        //查看对象内部信息
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
    }

    public static void testArrayTest(){
        Object obj = new Integer[4];
        //查看对象内部信息
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
    }

}

class Test{
    private boolean flag;
    private long  p;
}
